<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <title>增删改查</title>
        <script type="text/javascript">
            function del(dno) {
                var ok = window.confirm("亲，删除了不可恢复哦");
                if (ok) {
                    document.location.href = "${pageContext.request.contextPath}/dept/del?deptno=" + dno;
                }
            }
        </script>
    </head>
    <body>
        <table border="1px" align="center" width="50%">
            <tr>
                <th>序号</th>
                <th>部门编号</th>
                <th>部门名称</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${deptList}" var="dept" varStatus="i">
                <tr>
                    <td>${i.count}</td>
                    <td>${dept.deptno}</td>
                    <td>${dept.dname}</td>
                    <td>
                        <a href="javascript:void(0)" onclick="del(${dept.deptno})">删除</a>
                        <a href="${pageContext.request.contextPath}/dept/detail?f=edit&dno=${dept.deptno}">修改</a>
                        <a href="${pageContext.request.contextPath}/dept/detail?f=detail&dno=${dept.deptno}">详情</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <a href="${pageContext.request.contextPath}/mvc/add.jsp">新增部门</a>
    </body>
</html>
